|
|
|
|
|
|
|
button caption says Save Bookmark. Click the command button to create a Bookmark that points to this record of the collection. The caption changes to Restore Bookmark. Now use the arrow buttons on the data control to move to another record on the form. Click the command button. You see that the record pointer has been returned to the first record in the collection. This is because the Recordset Bookmark property was reset to the value you stored earlier. |
|
|
|
|
|
|
|
|
If you are accessing data from an ODBC (Open Database Connectivity) data source, the only Visual Basic data object you can use to update the underlying data table is a Dynaset-type Recordset. You learn more about ODBC connected databases on Day 19, ''ODBC Data Access Via the ODBC API." |
|
|
|
|
|
|
|
|
Limitations of the Dynaset-Type Recordset Data Object |
|
|
|
|
|
|
|
|
Although the Dynaset is an excellent data object, it has a few drawbacks that must be considered. Chief among these is that Dynasets do not allow you to specify an existing index, and you cannot use the Visual Basic Seek method to quickly locate a single record in the Dynaset. Also, errors can occur when displaying records in a Dynaset if the records in the underlying data table have been altered or deleted by another user. |
|
|
|
|
|
|
|
|
Dynaset Access and Seek Limitations |
|
|
|
|
|
|
|
|
Dynasets cannot make use of Index objects that exist in a database because the Index is built to control the entire data table and not just a subset of the data. Because Dynasets could be subsets of the data table, the Index is useless. Also, because you cannot specify an Index object for a Dynaset, you cannot use the Visual Basic Seek method on a Dynaset. |
|
|
|
|
|
|
|
|
These are only minor limitations. If you have defined an Index in the underlying table with the Primary flag turned on, the Visual Basic data engine uses the primary key index when creating the Dynaset. This usually puts the Dynaset in optimal order. Even though you cannot use the Seek method on a Dynaset, you can use the FindFirst, FindNext, FindPrevious, and FindLast methods. Even though they are not true index searches, they are fast enough for operations on small- to medium-sized Dynasets. You learn more about Seek, Find, and Move in Day 10, "Creating Database Programs with Visual Basic Code." |
|
|
|
|
|